package edu.gdkm.sql.dao;

import edu.gdkm.sql.pojo.Order;
import edu.gdkm.sql.pojo.Orderdetail;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper {
    // 查询全部类别
    @Select("select * from `order`")
    List<Order> findAll();
    // 根据id查询类别
    @Select("SELECT * FROM `order` WHERE id = #{id}")
    Order findById(int id);
    // 添加类别
    @Insert("INSERT INTO `order`(userinfoid,orderdate) VALUES(#{userinfoid},#{orderdate})")
    int insertOrder(Order order);

    // 更新类别
    @Update("UPDATE `order` SET userinfoid=#{userinfoid},orderdate=#{orderdate} WHERE id=#{id}")
    int updateOrderById(Order order);

    // 删除类别
    @Delete("DELETE FROM `order` WHERE id=#{id}")
    int deleteOrderById(int id);
}
